package com.emeraldparser.util;

import java.util.Map;
import java.util.Set;

import com.google.common.base.Function;
import com.google.common.collect.ForwardingSet;

public class BijectiveMappingSet<E, K> extends ForwardingSet<E> {

	private final Set<E> delegate;
	private final Function<E, K> keyFunction;
	private final Map<K, E> map;

	public BijectiveMappingSet(Set<E> delegate, Function<E, K> keyFunction, Map<K, E> map) {
		this.delegate = delegate;
		this.keyFunction = keyFunction;
		this.map = map;
	}

	@Override
	protected Set<E> delegate() {
		return delegate;
	}

	private K key(E element) {
		return keyFunction.apply(element);
	}

}
